package main

import (
	"Test/1goAdvanced/1structTest/object"
	"encoding/json"
	"fmt"
)

//练习go结构体转化为json格式

func main() {
	var student object.Student = object.Student{"魏正想", 18, 99}
	marshal, err := json.Marshal(student)
	if err != nil {
		fmt.Println("用户错误")
	}
	//将字符数切片转为string类型
	fmt.Println(string(marshal))

}
